
const testLogin = (req, res, next) => {
    const { username, password } = req.body

    if (!username || !password) next(4)

    if (username.length < 5 || username.length > 12 || password.length < 5 || password.length > 12) return next(5)


    next()
}

const testId = (req, res, next) => {
    // 拿到前端传递来的 id
    const id = req.params.id || req.body.id
  
    // 判断不符合规则
    if (id.length !== 24) return next(5)
  
    next()
  }


module.exports = {  
    testLogin,
    testId
}